--- import type { InferGetStaticParamsType, InferGetStaticPropsType, } from "astro"; import Base from "@layouts/Base.astro"; import DateSelector from "@components/DateSelector.astro"; import SimplePostList from "@components/templates/SimplePostList.astro"; import { datePaths, sortLastCreated } from "@lib/collection/helpers"; export const getStaticPaths = datePaths; export type Params = InferGetStaticParamsType; export type Props = InferGetStaticPropsType; let { posts, previous, next, years, months, days } = Astro.props; posts = posts.sort(sortLastCreated); const dateParts = Astro.params.date?.split("/").map(Number); const y = dateParts?.[0]; const m = dateParts?.[1] ?? 1; const d = dateParts?.[2] ?? 3; const date = (y !== undefined) ? new Date(Date.UTC(y, m - 1, d)) : undefined; const format = date === undefined ? undefined : new Intl.DateTimeFormat("pt-PT", { year: y === undefined ? undefined : "numeric", month: dateParts?.[1] === undefined ? undefined : "long", day: dateParts?.[2] === undefined ? undefined : "numeric", }).format(date); const title = "Publicações" + (format !== undefined ? ` -- ${format}` : ""); const description = "Ultímas publicações" + (format !== undefined ? ` do dia ${format}` : "") + "."; ---

{title}

{ (next || previous) && ( ) } { (next || previous) && ( ) }